//
//  UIView+Category.h
//  DCProject
//
//  Created by bigbing on 2019/4/1.
//  Copyright © 2019 bigbing. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_OPTIONS(NSUInteger, UIBorderSideType) {
    UIBorderSideTypeAll  = 0,
    UIBorderSideTypeTop = 1 << 0,
    UIBorderSideTypeBottom = 1 << 1,
    UIBorderSideTypeLeft = 1 << 2,
    UIBorderSideTypeRight = 1 << 3,
};

NS_ASSUME_NONNULL_BEGIN

//typedef UIView * _Nonnull(^DHViewIntegerBlock)(NSInteger tag);
//typedef UIView * _Nonnull(^DHViewCGRectBlock)(CGRect frame);
//typedef UIView * _Nonnull(^DHViewCGPointBlock)(CGPoint point);
//typedef UIView * _Nonnull(^DHViewViewBlock)(UIView * _Nullable view);
//typedef UIView * _Nonnull(^DHViewColorBlock)(UIColor * _Nullable color);
//typedef UIView * _Nonnull(^DHViewColorHexBlock)(NSString * _Nullable colorHex);
//typedef UIView * _Nonnull(^DHViewFloatBlock)(CGFloat f);
//typedef UIView * _Nonnull(^DHViewBOOLBlock)(BOOL bol);
//typedef UIView * _Nonnull(^DHViewUIViewContentModeBlock)(UIViewContentMode model);

#pragma mark - 分类 关于view.frame
@interface UIView (Category)

@property (nonatomic , assign) CGFloat dc_width;
@property (nonatomic , assign) CGFloat dc_height;
@property (nonatomic , assign) CGSize  dc_size;
@property (nonatomic , assign) CGFloat dc_x;
@property (nonatomic , assign) CGFloat dc_y;
@property (nonatomic , assign) CGPoint dc_origin;
@property (nonatomic , assign) CGFloat dc_centerX;
@property (nonatomic , assign) CGFloat dc_centerY;
@property (nonatomic , assign) CGFloat dc_right;
@property (nonatomic , assign) CGFloat dc_bottom;

- (BOOL)intersectWithView:(UIView *)view;

+ (instancetype)dc_viewFromXib;
- (BOOL)isShowingOnKeyWindow;

#pragma mark - XIB 设置圆角
@property(nonatomic,assign) IBInspectable CGFloat cornerRadius;

#pragma mark - XIB 设置边框颜色和宽度
@property(nonatomic,assign) IBInspectable UIColor * borderColor;
@property(nonatomic,assign) IBInspectable CGFloat borderWidth;

/**
 * @brief 移除此view上的所有子视图
 */
- (void)removeAllSubviews;

-(void)setPriorityRequired;


//#pragma mark - 简化设置对象内容
//+ (UIView *)dc_init;
////基础
//@property (nonatomic,copy) DHViewIntegerBlock dc_tag;
//@property (nonatomic,copy) DHViewCGRectBlock dc_frame;
//@property (nonatomic,copy) DHViewCGRectBlock dc_bounds;
//@property (nonatomic,copy) DHViewCGPointBlock dc_center;
////添加子视图
//@property (nonatomic,copy) DHViewViewBlock dc_addSubview;
////背景
//@property (nonatomic,copy) DHViewColorBlock dc_backgroundColor;
//@property (nonatomic,copy) DHViewColorHexBlock dc_backgroundColorHex;
////圆角
//@property (nonatomic,copy) DHViewFloatBlock dc_cornerRadius;
////超出是否隐藏
//@property (nonatomic,copy) DHViewBOOLBlock dc_clipsToBounds;
//
////边框
//@property (nonatomic,copy) DHViewFloatBlock dc_borderWidth;
//@property (nonatomic,copy) DHViewColorBlock dc_borderColor;
//@property (nonatomic,copy) DHViewColorHexBlock dc_borderColorHex;
//
////透明度
//@property (nonatomic,copy) DHViewFloatBlock dc_alpha;
//@property (nonatomic,copy) DHViewBOOLBlock dc_opaque;
////是否隐藏
//@property (nonatomic,copy) DHViewBOOLBlock dc_hidden;
////显示模式
//@property (nonatomic,copy) DHViewUIViewContentModeBlock dc_contentMode;
////是否可以触发手势
//@property (nonatomic,copy) DHViewBOOLBlock dc_userInteractionEnabled;

@end


#pragma mark - 分类 关于view的边框 切角
@interface UIView (BorderLine)


- (UIView *)dc_borderForColor:(UIColor *)color borderWidth:(CGFloat)borderWidth borderType:(UIBorderSideType)borderType;


#pragma mark - 任意切角
- (void)dc_cornerRadius:(CGFloat)readius rectCorner:(UIRectCorner)rectCorner;

#pragma mark - 切角
- (void)dc_cornerRadius:(CGFloat)readius;


#pragma mark - 边框  切角
- (void)dc_layerBorderWith:(CGFloat)width color:(UIColor *)color radius:(CGFloat)radius;

// 设置 cell 上左上右为圆角
- (void)setTopRoundedCorners;
// 设置 cell 下左下右为圆角
- (void)setBottomRoundedCorners;
// 取消圆角
- (void)resetRoundedCorners;
// 设置 cell 的四个角为圆角
- (void)setRoundedCorners;

@end

NS_ASSUME_NONNULL_END
